package com.hucc.redislock;

import redis.clients.jedis.Jedis;
import redis.clients.jedis.JedisPool;

public class Demo1 {

    public static void main(String[] args) throws Exception{
        JedisPool jedisPool = new JedisPool("192.168.102.187", 6379);
        RedisLockFactory redisLockFactory = new RedisLockFactory(jedisPool);

        RedisLock redisLock = redisLockFactory.getLock("testLock");

        try {
            redisLock.lock();
            System.out.println(1);
            System.out.println(2);
            System.out.println(3);
        } finally {
//            redisLock.unlock();
        }
    }
}
